package net.fonline.apps;

/**
 * A EventEntity is required for the OnClickEvent-handler.
 * It can detect weather it has been clicked on it or not.
 * @author Michael
 */
public class EventEntity {

    private EventEntity next = null;
    private int x = 0;
    private int y = 0;
    private int height = 0;
    private int width = 0;
    private String name = "";

    public EventEntity(String name, int x, int y, int width, int height) {
        this.height = height;
        this.width = width;
        this.x = x;
        this.y = y;
        this.name = name;
        this.next = null;
    }

    public String getName() {
        return this.name;
    }

    public boolean collidesWith(int x, int y) {
        return (this.x < x) && (x < this.x + this.width)
                && (this.y < y) && (y < this.y + this.height);
    }

    public EventEntity getNext() {
        return this.next;
    }

    public void setNext(EventEntity next) {
        this.next = next;
    }
}